﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;


namespace btvskipfix
{
    class Program
    {
        const int BufferSize = 8096;
        static void Main(string[] args)
        {
            if (args.Length != 1)
            {
                Console.WriteLine("USAGE: btvskipfix <input file>");
                return;
            }

            TextReader txtinput = new StreamReader(new FileStream(args[0], FileMode.Open,FileAccess.Read,FileShare.ReadWrite),Encoding.Unicode);
            
            TextWriter txtoutput = new StreamWriter(new FileStream("output.xml",FileMode.Create),Encoding.ASCII);
            char[] buffer = new char[BufferSize];
            int len;
            while ((len = txtinput.Read(buffer, 0, BufferSize)) > 0)
            {
                        txtoutput.Write(buffer, 0, len);
            }
            txtinput.Close();
            txtoutput.Close();
            File.Replace("output.xml", args[0], args[0] + ".bak");
            File.Delete("output.xml");
        }
    
    }

}